<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="zxx">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="icon" href="images/favicon.png">
    <title></title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="css/materialize.css">
    <link rel="stylesheet" href="css/loaders.css">
    <link rel="stylesheet" href="css/lightbox.css">
    <link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
    <link rel="stylesheet" href="css/owl.carousel.min.css">
    <link rel="stylesheet" href="css/owl.theme.default.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/layer.css">


</head>
<style>
    .segments-page {
        padding: 68px 20px 25px;
    }

    .input-radio {
        margin: 0 0 10px 0;
        display: inline-block;
    }


</style>
<body>

<!-- navbar -->
<div class="navbar">
    <div class="container">
        <div class="row">
            <div class="col s9">
                <div class="content-left" onclick="javascript:history.back(-1);">
                    <i class="fa fa-chevron-left center"></i>
                </div>
            </div>

        </div>
    </div>

</div>
<!-- end navbar -->

<!-- sidebar -->
<div class="segments-page">
    <div class="container">
        <div class="settings">
            <div class="pages-title">
                <h3>购买积分</h3>
                <div class="line"></div>
            </div>
            <form  id="form" onsubmit="return false" action="#" method="post" >
				    <input type="hidden"name="bank_id"  id="bank_id" >
                <input type="number" min=10000 name="quantity"  id="quantity" placeholder="购买数量">
                <div>
                    <div class="input-radio">
                        <input id="orange" type="radio" name="payType" value="1" checked/>
                        <label for="orange">银行卡</label>
                    </div>
                  
                   
                </div>
               
                    <input type="text" readonly="readonly" name="bank" placeholder="请选择付款账号" id="bank">
                  <p>公司账号:</p>
                  <textarea class="no-mb" cols="30" id="textarea" rows="10" disabled style="    margin-top: -7px;"></textarea>
             
          <p>请上传打款截图:</p>
       <div id="drop_area"><input type="hidden" name="file" value=""  id="file" ></div>
                <button class="button" onclick="addbuy();">提交</button>
            </form>
        </div>
    </div>
</div>
<!-- end sidebar -->

<!-- list -->

<!-- end list -->

<script src="js/jquery.min.js"></script>
<script src="js/materialize.js"></script>
<script src="js/numscroller.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/main.js"></script>
<script src="js/layer.js"></script>
<script src="js/jquerysession.js"></script>
<script src="http://www.gongjuji.net/Content/files/jquery.md5.js"></script>
<script src="js/index.js"></script>
<script src="js/mobileSelect.js"></script>
<script src="js/uploading.js"></script>
<script src="js/exif.js"></script>


<script>
    jQuery(function ($) {
        var UserbankList = 'Member/UserbankList';
        var UserbankList = api_request(UserbankList, 'GET');
	
//卡号选择
var data=UserbankList.data.data
	if(data.length !=0){
	
	var mobileSelect1 = new MobileSelect({
	    trigger: '#bank',
	    title: '卡号选择',
	    wheels: [
	        {data: data}
	    ],
	    transitionEnd: function (indexArr, data) {
	
	    },
	    callback: function (indexArr, data) {
	        $("#bank").val(data[0].value)
			   $("#bank_id").val(data[0].id)
	    }
	});
	var paycode = 'cms/label';
	var paycodeList = api_request(paycode, 'GET');
	$('#WeChat-code').attr('src', paycodeList.data.WeChat);
	$('#alipay-code').attr('src', paycodeList.data.alipay);
}else{
		$('#bank').attr('placeholder','暂时未绑定银行卡')
}
        var Money_accounturl = 'cms/label/name/Money_account';
        var Money_account = api_request(Money_accounturl, 'GET');
        if(Money_account.data){
        	var text = document.getElementById("textarea");
        	var str = Money_account.data;
        	str = str.replace("<br>", "\n");
		
        	text.innerHTML = str;
        }

    });
	

    function addbuy() {		
		
     if ($("#quantity").val() == ""||$("#quantity").val() == "0") {
         layer.open({
             content: '请输入购买数量!'
             , skin: 'msg'
             , time: 3 //2秒后自动关闭
         });
         return false;
     }
if($("#bank_id").val() == ""){
  layer.open({
             content: '请选择付款账号!'
             , skin: 'msg'
             , time: 2 //2秒后自动关闭
         });
         return false;
}
 // if ($("#file").val() == "") {
 //         layer.open({
 //             content: '请上传打款截图!'
 //             , skin: 'msg'
 //             , time: 2 //2秒后自动关闭
 //         });
 //         return false;
 //     }
	

var params = $('#form').serializeObject();

	var addBuyUrl = 'Buy/addBuy';

	var addBuyinfo = api_request(addBuyUrl, 'POST',params)
	  
if(addBuyinfo.code==1){
	layer.open({
	    content: addBuyinfo.data
	    , skin: 'msg'
	    , time: 2//2秒后自动关闭
	    , end: function () {
			   location.reload();
	    }
	});
}
    }
 
	   var dragImgUpload = new DragImgUpload("#drop_area",{
	         callback:function (files) {
					 data={
						 upload:files[0]
					 }
			   var uploadUrl = 'Buy/upload';
			    
			   var uploadinfo = api_request(uploadUrl, 'POST',data,'1')
		
		if(uploadinfo.code==1){
			 $('#file').attr('value',uploadinfo.data)
			layer.open({
			    content: '上传成功！'
			    , skin: 'msg'
			    , time: 2//2秒后自动关闭
			   
			});
		}
			
	         }
	     })


</script>
</body>
</html>